#pragma once

class Thread
{
	struct ThreadInfo
	{
		std::function<void ()> mFunction;
	};

private:
	static unsigned long __stdcall ThreadProc(LPVOID data) {
		ThreadInfo* inf = (ThreadInfo*)data;
		if(inf != NULL) {
			inf->mFunction();
		}
		ExitThread(0);
	}

public:
	static void executeFunction(std::function<void ()> fun) {
		ThreadInfo* inf = new ThreadInfo();
		inf->mFunction = fun;
		CreateThread(NULL, 0, ThreadProc, inf, 0, NULL);
	}
};